<%= form_for(@contact, url: 
	if params.has_key?(:patient_id)
		patient_contacts_path
	else
		staff_contacts_path
	end
) do |f| %>
  <% if @contact.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@contact.errors.count, "error") %> prohibited this contact from being saved:</h2>

      <ul>
      <% @contact.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <% f.label :contact_type_id %>Tipe Alamat<br>
    <%= collection_select(:contact, :contact_type_id, ContactType.all, :id, :label, prompt: true) %>
    <%= link_to 'New Contact Type', 
    	if params.has_key?(:patient_id)
    		new_patient_contact_type_path 
    	else
    		new_staff_contact_type_path 
    	end
    %>
  </div>
  <div class="field">
    <% f.label :address %>Alamat<br>
    <%= f.text_area :address %>
  </div>
  <div class="field">
    <% f.label :postal_code %>Kode Pos<br>
    <%= f.number_field :postal_code %>
  </div>
  <div class="field">
    <% f.label :phone %>Nomor Telephone<br>
    <%= f.text_field :phone %>
  </div>
  <div class="field">
    <% f.label :fax %>Nomor Fax<br>
    <%= f.text_field :fax %>
  </div>
    <%= f.submit "Masukan" %>
  </div>
<% end %>
